import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/motherPage.vue')
  },
  {
    path: '/book',
    name: 'book',
    component: () => import('@/views/book.vue'),
    redirect: '/book/movie',
    // meta: { isShow: true }, // 这里使用路由存储isShow状态，用于页面的状态判断
    children: [
      {
        path: 'movie',
        name: 'movie',
        component: () => import('@/views/book/movie.vue'),
        children: [
          {
            path: 'watching',
            name: 'watching',
            component: () => import('@/views/book/moreMovie/watching.vue')
          }
        ]
      },
      {
        path: 'picBook',
        name: 'picBook',
        component: () => import('@/views/book/picBook.vue')
      },
      {
        path: 'TV',
        name: 'TV',
        component: () => import('@/views/book/TV.vue')
      },
      {
        path: 'city',
        name: 'city',
        component: () => import('@/views/book/city.vue')
      },
      {
        path: 'music',
        name: 'music',
        component: () => import('@/views/book/music.vue')
      }
    ]
  },
  {
    path: '/broadCast',
    name: 'broadCast',
    component: () => import('@/views/broadCast.vue')
    // meta: { isShow: true }
  },
  {
    path: '/group',
    name: 'group',
    component: () => import('@/views/group.vue')
    // meta: { isShow: true }
  },
  {
    path: '/my',
    name: 'my',
    component: () => import('@/views/my.vue')
    // meta: { isShow: true }
  },
  {
    path: '/more',
    name: 'more',
    component: () => import('@/views/more.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
